/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author dong
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import {BasicModel, Page, TreeDataModel} from '/@/api/model/baseModel';

const { adminPath } = useGlobSetting();

export interface JydqProduct extends BasicModel<JydqProduct> {
  categoryId?: string; // 分类ID
  name?: string; // 商品名称
  brand?: string; // 品牌名称
  model?: string; // 型号规格
  specifications?: string; // 详细参数
  image?: string; // 图片
  marketPrice?: number; // 市场价
}

export const jydqProductList = (params?: JydqProduct | any) =>
  defHttp.get<JydqProduct>({ url: adminPath + '/jydq/product/list', params });

export const jydqProductListData = (params?: JydqProduct | any) =>
  defHttp.post<Page<JydqProduct>>({ url: adminPath + '/jydq/product/listData', params });

export const jydqProductForm = (params?: JydqProduct | any) =>
  defHttp.get<JydqProduct>({ url: adminPath + '/jydq/product/form', params });

export const jydqProductSave = (params?: any, data?: JydqProduct | any) =>
  defHttp.postJson<JydqProduct>({ url: adminPath + '/jydq/product/save', params, data });

export const jydqProductDelete = (params?: JydqProduct | any) =>
  defHttp.get<JydqProduct>({ url: adminPath + '/jydq/product/delete', params });

export const productTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/jydq/product/treeData', params });

export const jydqMyFavorite = (params?: JydqProduct | any) =>
  defHttp.post<Page<JydqProduct>>({ url: adminPath + '/jydq/product/myFavorite', params });
